import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:get/get.dart';

import '../../../../base/utils/timeUtil.dart';
import '../controllers/news_detail_controller.dart';

class NewsDetailView extends GetView<NewsDetailController> {
  const NewsDetailView({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: const Color(0xffF1F1F1),
        appBar: BrnAppBar(
          automaticallyImplyLeading: true,
          title: "咨询详情",
          backgroundColor: Colors.white,
          showDefaultBottom: false,
          backLeadCallback: () => Get.back(),
        ),
        body: Container(
            padding: const EdgeInsets.all(8),
            margin: EdgeInsets.only(
              top: 8,
            ),
            color: Colors.white,
            child: ListView(
              children: [
                Padding(
                  padding: EdgeInsets.only(left: 6),
                  child: Text(
                    controller.article?.title ?? "",
                    style: const TextStyle(
                      fontSize: 18,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                ),
                const SizedBox(
                  height: 4,
                ),
                Padding(
                  padding: EdgeInsets.only(left: 6),
                  child: Text(
                    "-分类：${controller.article.category??''}",
                    textAlign: TextAlign.right,
                    style: const TextStyle(
                      fontSize: 14,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                ),
                const SizedBox(
                  height: 8,
                ),
                Html(
                  data: controller.article?.content ?? "",
                ),
                Padding(
                  padding: EdgeInsets.only(left: 6),
                  child: Text(
                    controller.article?.author ?? "",
                    style: const TextStyle(
                      fontSize: 12,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                ),
                const SizedBox(
                  height: 8,
                ),
                Padding(
                  padding: EdgeInsets.only(left: 6),
                  child: Text(
                    "发表时间：${formatTimestamp(controller.article?.createTime)}",
                    textAlign: TextAlign.right,
                    style: const TextStyle(
                      fontSize: 12,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                ),
                const SizedBox(
                  height: 40,
                ),
              ],
            )));
  }
}
